import moment from 'moment'
import dt from '@dt/dt'
import baseApi from '@/config/server/api/base.js'

let time = null

function list(info) {
  time = info.current == '1' ? moment(new Date()).format('YYYY-MM-DD HH:mm:ss') : time
  let params = {
    requestDate: time,
    data: {}
  }
  for (let key in info) {
    if (key == 'current' || key == 'rows') {
      params[key] = info[key]
    } else {
      params.data[key] = info[key]
    }
  }
  return baseApi.processAudit.list.fetch(params)
}

function process(info) {
  return baseApi.processAudit.process.fetch(info)
}

function audit(info) {
  // auditId auditReason auditResultFlag 1-通过，2-驳回
  return baseApi.processAudit.audit.fetch(info)
}

function back(info) {
  // auditType 审批类型：1-奖金模板，2-职级点数，3-奖金单，4-在销激励，5-项目津贴 6 businessId
  return baseApi.processAudit.back.fetch(info)
}

function transfer(info) {
  return baseApi.processAudit.transfer.fetch(info)
}

export default {
  list,
  process,
  audit,
  back,
  transfer
}
